using FluentValidation;
using FluentValidation.AspNetCore;
using Microsoft.Extensions.DependencyInjection;

namespace Gateway.IApplication.Validation;

/// <summary>
/// fluent validation 扩展
/// </summary>
public static class FluentValidationExtension
{
    /// <summary>
    /// 注入fluent validation
    /// </summary>
    /// <param name="services"></param>
    public static void AddFluentValidationSetup(this IServiceCollection services)
    {
        services.AddFluentValidationAutoValidation();
        services.AddValidatorsFromAssemblyContaining(typeof(IFluentValidation));
    }
}